﻿@using ControleRepresentante.Logic.Models
@using WebSite.ViewModels
@using WebSite.ViewModels.IndexViewModels
@using System.Web.Mvc

@{
    Layout = null;
}

@model IndexViewModel
<!DOCTYPE html>
<html>
<head>
    <link href="@Url.Content("~/Content/Imprimir.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
    <title>@Model.Title</title>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            window.print();
        });
    </script>
</head>
<body style="margin-left: 0; margin-top: 0; font-family: Arial">
    <table bordercolor="#000000" cellspacing="5" cellpadding="10" width="1000" border="1">
        <tbody>
            <tr>
                <td>
                    <table cellspacing="0" cellpadding="0" width="100%" border="0">
                        <tbody>
                            <tr>
                                <td align="center">
                                    <strong><font size="4">
                                        @Html.Raw(Model.RepresentanteInfo.NomePedido.Replace("\n", "<br />"))
                                    </font></strong>
                                </td>
                                <td valign="middle" align="center" width="291">
                                    @Html.Raw(Model.RepresentanteInfo.InfoPedido.Replace("\n", "<br />"))
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    @{
                        IndexColumnDefinitionsCollection columnsCollection = Model.GetIndexColumnDefinitions();
                        IEnumerable<IIndexColumnDefinition> columns = Model.GetIndexColumnDefinitions().GetIndexColumns()
                            .Where(x => x.ShouldShow(Model.IndexColumnsProvider.GetIndexColumns()));
                    }
                    <table cellspacing="0" cellpadding="2" rules="all" border="1" id="Tabela" style="border-color: Black;
                        border-width: 1px; border-style: solid; width: 100%; border-collapse: collapse;">
                        <tr style="font-weight: bold;">
                            @foreach (IIndexColumnDefinition column in columns)
                            {
                                <td>@column.Header
                                </td>
                            }
                        </tr>
                        @foreach (ModelBase model in Model.Models)
                        {
                            <tr>
                                @foreach (IIndexColumnDefinition column in columns)
                                {
                                    <td>@(new MvcHtmlString(column.GetValue(model, Html)))
                                    </td>
                                }
                            </tr>
                        }
                    </table>
                </td>
            </tr>
        </tbody>
    </table>
</body>
</html>
